package cn.ronghuanet.org.controller;

import cn.ronghuanet.auth.annotation.RonghuanetPermission;
import cn.ronghuanet.base.util.AjaxResult;
import cn.ronghuanet.org.domain.Employee;
import cn.ronghuanet.org.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.codec.json.AbstractJackson2Decoder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/employee")
@RonghuanetPermission(name = "员工管理")
public class EmployeeController {
    @Autowired
    private IEmployeeService service;

    @GetMapping
    @RonghuanetPermission(name = "查询所有员工")
    public AjaxResult queryEmps(){
        try {
            List<Employee> list = service.selectAll();
            return AjaxResult.success(list);
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.error();
        }
    }
}
